package com.example.smartagrisys.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.smartagrisys.entity.Fertilizer;
import com.example.smartagrisys.mapper.FertilizerMapper;
import com.example.smartagrisys.service.FertilizerService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 肥料服务实现
 */
@Slf4j
@Service
public class FertilizerServiceImpl extends ServiceImpl<FertilizerMapper, Fertilizer> implements FertilizerService {

    @Override
    public List<Fertilizer> listAllFertilizers() {
        // 按名称排序
        LambdaQueryWrapper<Fertilizer> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.orderByAsc(Fertilizer::getName);
        return list(queryWrapper);
    }
} 